package com.innoking.docsys.utils;

import java.util.HashMap;

/**
 * @Description:返回工具类
 * @Auther: S
 * @Date: 2018/8/23 13:58
 */
public class ResultUtil {

    public static ResultObjVO success(Object object) {
        ResultObjVO vo = new ResultObjVO();
        vo.setMsg("成功");
        vo.setStatus(StatusUtil.STATUS_OK);
        vo.setObj(object);
        return vo;
    }

    public static ResultObjVO success() {
        return ResultUtil.success(new HashMap<String, String>());
    }

    public static ResultObjVO error( String msg) {
        ResultObjVO vo = new ResultObjVO();
        vo.setMsg(msg);
        vo.setStatus(StatusUtil.STATUS_ERROR);
        vo.setObj(new HashMap<String, String>());
        return vo;
    }

    public static ResultObjVO tokenError( ) {
        ResultObjVO vo = new ResultObjVO();
        vo.setMsg("token 不存在或token无效！");
        vo.setStatus(StatusUtil.TOKEN_ERROR);
        vo.setObj(new HashMap<String, String>());
        return vo;
    }
    public static ResultObjVO  emptyData() {
        ResultObjVO vo = new ResultObjVO();
        vo.setMsg("token 不存在或token无效！");
        vo.setStatus(StatusUtil.STATUS_NONE);
        vo.setObj(new HashMap<String, String>());
        return vo;
    }
    public static ResultObjVO error(String status, String msg,Object object) {
        ResultObjVO vo = new ResultObjVO();
        vo.setMsg(msg);
        vo.setStatus(status);
        vo.setObj(object);
        return vo;
    }

    public static ResultObjVO error() {
        return ResultUtil.error( "失败");
    }

    public static ResultObjVO resData(Object object, String msg, String status) {
        ResultObjVO vo = new ResultObjVO();
        vo.setMsg(msg);
        vo.setObj(object);
        vo.setStatus(status);
        return vo;
    }

    public static ResultObjVO paramNull( String msg) {
        ResultObjVO vo = new ResultObjVO();
        vo.setMsg(msg);
        vo.setStatus(StatusUtil.STATUS_PARAM);
        vo.setObj(new HashMap<String, String>());
        return vo;
    }
}
